Skip to content

Add UIInteractiveSpriteWidget for clickable sprites in UI#2849

Merged
eruvanos merged 5 commits intodevelopmentfrom
feature/interactive-sprite-widget
May 9, 2026
Merged

Add UIInteractiveSpriteWidget for clickable sprites in UI#2849
eruvanos merged 5 commits intodevelopmentfrom
feature/interactive-sprite-widget

Conversation

@pvcraven
Copy link
Copy Markdown
Member

@pvcraven pvcraven commented May 7, 2026

Summary

  • Adds UIInteractiveSpriteWidget — combines UIInteractiveWidget + UISpriteWidget via multiple inheritance to make sprites clickable/hoverable in the UI tree
  • Widget size defaults to sprite texture dimensions, overridable with explicit width/height
  • Inherits full interactive behavior: hovered, pressed, disabled states, on_click event dispatch, keyboard/controller support
  • Inherits sprite rendering: do_render() draws the sprite, on_update() calls sprite animation updates
  • Exported from arcade.gui as public API

Test plan

  • Click on sprite fires on_click event with correct source
  • Click outside does not fire
  • hovered updates on mouse enter/leave
  • pressed is True between press and release
  • disabled=True blocks click events
  • Widget rect defaults to sprite texture size
  • Explicit width/height overrides sprite size
  • Works inside UIBoxLayout and UIAnchorLayout
  • Callback via push_handlers(on_click=...) works
  • Callback via widget.on_click = callback works
  • All 349 existing GUI tests pass

🤖 Generated with Claude Code

Paul V Craven and others added 3 commits May 7, 2026 13:03
Combines UIInteractiveWidget and UISpriteWidget via multiple
inheritance, giving sprites full UI event dispatch: hover detection,
press tracking, click events, and disabled state — without
requiring manual hit testing or state management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Introduced UIInteractiveSpriteWidget for clickable sprites in the UI.
- Added example code demonstrating sprite interaction with hover and click feedback.
- Updated documentation to include the new interactive sprite widget and its usage.
@eruvanos
Copy link
Copy Markdown
Member

eruvanos commented May 9, 2026

@copilot mention the unreleased changes of this pr in CHANGELOG.md

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

@copilot mention the unreleased changes of this pr in CHANGELOG.md

Added the UIInteractiveSpriteWidget entry to the ## Unreleased section of CHANGELOG.md in commit f64b819.

Copilot AI requested a review from eruvanos May 9, 2026 20:33
@eruvanos eruvanos merged commit c278d2a into development May 9, 2026
7 checks passed
@eruvanos eruvanos deleted the feature/interactive-sprite-widget branch May 9, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants